#pragma once

#include "IDrawable.h"
#include "GuiEvent.h"
#include <string>
#include <vector>


class Widget :public IDrawable
{
protected:

	SDL_Texture * texture;

private:

	SDL_Rect area;
	std::string name;
	bool active;
	bool visible;

protected:

	std::vector<IDrawable*> addOns;
	std::vector<IDrawable*>::iterator addOnIt;
	
	void drawAddOns(SDL_Renderer * renderer);

public:

	Widget(void);
	virtual ~Widget(void);

	virtual void onEvent(GuiEvent & evt) = 0;
	virtual void draw(SDL_Renderer * renderer) = 0;

	SDL_Rect getArea();
	void setArea(SDL_Rect area);

	void setPosition(int x,int y);

	int getX();
	int getY();


	void setWidth(int width);
	void setHeight(int height);

	int getWidth();
	int getHeight();

	void setName(std::string name);
	std::string getName();

	bool isPointInside(int x,int y);

	void loadSkinFromFile(const char * fileName);

	bool isActive();
	bool isVisible();

	void setActive(bool active);
	void setVisible(bool visible);

	void addAddOn(IDrawable * obj);
	void deleteAddOn(IDrawable * obj);
	void removeAddOn(IDrawable * obj);


};

